import java.util.Scanner;  
class Rectangle{

    private double length;
    private double width;

    public Rectangle(){
        Scanner sc = new Scanner(System.in);
        System.out.println("输入矩形的长：");
        double length= sc.nextLine(); 
        if(length < 0){
            System.out.println("Input error!");
            System.exit(0);
        } 
        System.out.println("输入矩形的宽：");
        if(width < 0){
            System.out.println("Input error!");
            System.exit(0);
        } 
        double width = sc.nextLine();   
        this.length = length;
        this.width = width;
    }

    public double Ferim(){

        return (this.length + this.width)*2;
    }

    public double Area(){

        return this.length * this.width;
    }


    public static void main(String [] args){
        Rectangle rt =  new Rectangle();
        
        System.out.println("Perim:"+String.valueOf(tr.Ferim()));
        System.out.println("Area"+String.valueOf(rt.Area()));
    }

}